<!--
 * @Descripttion: 
 * @version: 
 * @Author: ada.wu
 * @Date: 2023-10-31 00:54:29
 * @LastEditors: ada.wu
 * @LastEditTime: 2023-10-31 00:59:16
-->
<template>
  <div>
    <div class="app_card mb-2 pt-4 pb-4">
      <div class="d-flex  align-items-center">
        <div>
          <el-button type="primary" @click="loadData()">初始化系统数据</el-button>
          <p style="margin-top:20px;">注：对系统添加的数据进行初始化加载，避免关闭程序引起的短暂时间不能访问。</p>

        </div>
      </div>
    </div>
  </div>
</template>
  
<script setup>
/**
 * 角色组件
 */
import { ref } from 'vue';
import { ElMessageBox, ElMessage } from 'element-plus';
import EsAjax from '@/utils/EsAjax';
import ApiUrls from '@/apis/index';

// ======================================================
//                      处理事件
// ======================================================

const loadData = () => {

  ElMessageBox.confirm("是否对数据进行重新加载？", '提示').then(() => {
    EsAjax.post(ApiUrls.systemInit, {}).then(res => {
      if (res.data.code != 200) {
        ElMessage.warning(res.data.data+res.data.msg);
        return;
      }
      ElMessage.success('重载成功！');

    }).catch(err => {
      ElMessage.error('重载失败！');
    })
  }).catch(() => { });





}

</script>
  
